const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    mode: 'development',
    devtool: 'inline-source-map',
    entry: {
        index: {
            import: './src/index.js',
            // dependOn: "shared"

        },
        anothor: {
            import: "./src/another_module.js",
            // dependOn: ["shared"]
        },
        // shared: "lodash",
        // jqueryA: "jquery"
    },
    plugins: [
        new HtmlWebpackPlugin({
            title: 'Development',
        }),
    ],
    output: {
        filename: '[name].bundle.js',
        path: path.resolve(__dirname, 'dist'),
        clean: true,
        publicPath: '/test', // 配置path路径 如 http://localhost:3000/test
    },
    // 本地服务
    devServer: {
        static: './dist',
    },

    // optimization: {
    //     runtimeChunk: 'single',
    // },
    optimization: {
        splitChunks: {
            chunks: 'all',
        },
    },
};